package org.loneranger.p1_get_bean.demo;

import org.loneranger.p1_get_bean.bean.MyUser;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 通过XML的方式获取Bean
 *
 * @author loneranger
 */
public class XMLBeanTest {

	public static void main(String[] args) {


		//这是JavaBean对象
		MyUser user1 = new MyUser();

		ClassPathXmlApplicationContext classPathXmlApplicationContext =
				new ClassPathXmlApplicationContext("spring.xml");

		/**
		 * 这是SpringBean对象
		 * 由Spring管理的对象，由Spring生成
		 */
		MyUser user = classPathXmlApplicationContext.getBean("user", MyUser.class);

	}
}
